<template>
  <view class="sign-up-detail">
    <view class="sign-up-info">
      <text class="title">
        报名信息
      </text>
      <view class="info-list">
        <view class="info">
          <text class="label">
            姓名
          </text>
          <text class="value">
            {{ useFormatEmpty(userSignUpInfo.userName) }}
          </text>
        </view>
        <view class="info">
          <text class="label">
            联系方式
          </text>
          <text class="value">
            {{ useFormatEmpty(userSignUpInfo.userPhone) }}
          </text>
        </view>
        <view class="info">
          <text class="label">
            报名时间
          </text>
          <text class="value">
            {{ useFormatEmpty(userSignUpInfo.createTime) }}
          </text>
        </view>
        <view class="info">
          <text class="label">
            活动状态
          </text>
          <text class="value">
            {{ useFormatEmpty(userSignUpInfo.signIn) === 0  ? '已签到':'未签到' }}
          </text>
        </view>
      </view>
    </view>
    <view class="activity-info">
      <text class="title">
        活动信息
      </text>
      <activity-item :activity-item="activityInfo" :show-activity-img="false"/>
    </view>
  </view>
</template>
<script setup>
import {ref,reactive} from 'vue'
import {onShow} from "@dcloudio/uni-app";
import {getUrlParamsInH5, getUrlParamsInWeixin} from "@/utils/utils";
import {getUserSignUpActivityDetailApi} from "@/api/activity";
import {useFormatEmpty} from "@/utils/formatHooks";
import ActivityItem from "@/package_activity/components/activity-item.vue";

let userSignUpInfo = ref({
  userName: '',
  userPhone: '',
  signTime: '',
  signIn: ''
})
const activityInfo = ref({})

const urlParams = ref({})
const getUserSignUpActivityDetail = async () => {
  const res = await getUserSignUpActivityDetailApi(urlParams.value?.activityId)
  const {code, data} = res
  if (code === 200) {
    const {activity,activityUser} = data || {}
    userSignUpInfo.value = activityUser
    activityInfo.value = activity
  }
}
onShow(() => {
  /* #ifdef MP-WEIXIN */
  urlParams.value = getUrlParamsInWeixin()
  /* #endif */

  /* #ifdef H5 */
  urlParams.value = getUrlParamsInH5()
  /* #endif */
  getUserSignUpActivityDetail()
})
</script>
<style lang="less" scoped>
.sign-up-detail {
  width: 100vw;
  .sign-up-info {
    width: 100vw;
    padding: 46rpx 27rpx 42rpx 39rpx;
    box-sizing: border-box;
    background-color: @color-origin-white;
    font-family: 'ali-p';

    .title {
      font-weight: 700;
      font-size: 31rpx;
      color: @color-black-text;
    }

    .info-list {
      margin-top: 42rpx;
      .info {
        display: flex;
        justify-content: space-between;
        margin-top: 28rpx;
        padding-bottom: 28rpx;
        border-bottom: 1px solid @color-light-grey-border;
        font-size: 31rpx;
        .label {
          color: @color-black-text;
        }
        .value {
          color: @color-grey-text
        }
      }
    }


  }

  .activity-info {
    padding: 46rpx 27rpx 42rpx 39rpx;
    margin-top: 32rpx;
    box-sizing: border-box;
    background-color: @color-origin-white;
    font-family: 'ali-p';
    .title {
      font-weight: 700;
      font-size: 31rpx;
      color: @color-black-text;
    }
  }
}
</style>